{% extends 'common/base_admin.html' %}

{% load static %}


{% block content-title %}
评测管理及统计
{% if error_info %}
<span style="color: red;">{{ error_info }}</span>
{% endif %}
{% endblock %}

{% block content %}
{% if class_list %}
<div class="layui-card-body">
    <div class="layui-btn-container">
        <table class="layui-table">
            <tr>
                <th>班级编号</th>
                <th>班级名称</th>
                <th>年级</th>
                <th>班主任</th>
                <th>评测状态</th>
                <th>课程数</th>
                <th>学生数</th>
                <th>评测量</th>
                <th>剩余量</th>
                <th>评测统计</th>
            </tr>
            {% for class_item in class_list %}
            <tr>
                <td>{{ class_item.class_id }}</td>
                <td>{{ class_item.class_name }}</td>
                <td>{{ class_item.grade }}</td>
                <td>{{ class_item.class_header_id.name }}</td>
                <td>
                    <a href="{% url 'manage:eval_switch' %}?class_id={{ class_item.class_id }}">
                    <div class="layui-form">
                        <input type="checkbox" title="开启|关闭" lay-skin="switch" {% if class_item.is_eval %} checked {% endif %}>
                    </div>
                </a>
                </td>
                <td>{{ class_item.course_count }}</td>
                <td>{{ class_item.student_count }}</td>
                <td>{{ class_item.eval_count }}</td>
                <td>{{ class_item.remain }}</td>
                <td>
                    <a
                        href="{% url 'manage:eval_statistic' %}?class_id={{ class_item.class_id }}">详细信息</a>
                </td>
            </tr>
            {% endfor %}
        </table>
    </div>
</div>

{% elif student_list %}
<div class="layui-card-body">
    <div class="layui-btn-container">
        <table class="layui-table">
            <tr>
                <th>班级编号</th>
                <th>班级名称</th>
                <th>学号</th>
                <th>姓名</th>
                <th>课程量</th>
                <th>评测数</th>
                <th>剩余评测数</th>
            </tr>
            {% for student in student_list %}
            <tr>
                <td>{{ student.class_id.class_id }}</td>
                <td>{{ student.class_name }}</td>
                <td>{{ student.student_id }}</td>
                <td>{{ student.name }}</td>
                <td>{{ student.course_count }}</td>
                <td>{{ student.eval_count }}</td>
                <td>
                    {% if student.remain == 0 %}
                    <font>{{ student.remain }}</font>
                    {% else %}
                    <font color="red"><strong>{{ student.remain }}</strong></font>
                    {% endif %}
                </td>
            </tr>

            {% endfor %}
        </table>
    </div>
</div>
{% else %}
<div class="layui-card-body">
    {{ error_info }}
</div>
{% endif %}
{% endblock %}

</div>